<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <body>

        <ui:composition template="./WEB-INF/template/simple/simpleTemplate.xhtml">

            <ui:define name="title">Registration</ui:define>
            
            <ui:define name="content">
                
                <h:form  class="centeredForm">
                        
                    
                        <p:panelGrid  columns="3">
                            <f:facet name="header">
                                Signup                          
                            </f:facet>
                            
                            <p:outputLabel for="name" value="Name"/>
                            <p:inputText id="name" value="#{guestHome.user.name}" required="true" requiredMessage="Name can't be empty" >
                                <p:ajax update="nameMsg" event="blur"/>                                
                            </p:inputText>
                            <p:message id="nameMsg" for="name" styleClass="longMsg" /> 
                            
                            <p:outputLabel for="surname" value="Surname"/>
                            <p:inputText id="surname" value="#{guestHome.user.surname}" required="true" requiredMessage="Surname can't be empty">
                                <p:ajax update="surnameMsg" event="blur"/>                                
                            </p:inputText>
                            <p:message id="surnameMsg" for="surname" styleClass="longMsg"/> 
                            
                            <p:outputLabel for="username" value="Email"/>
                            <p:inputText id="username" value="#{guestHome.user.email}" required="true" requiredMessage="Email can't be empty">
                                <p:ajax update="emailMsg" event="blur"/>                                
                            </p:inputText>
                            <p:message id="emailMsg" for="username" styleClass="longMsg"/> 
                            
                            <p:outputLabel for="pass" value="Password"/>
                            <p:password id="pass" value="#{guestHome.password}"
                                        feedback="true" match="pwd2" label="Password" required="true" requiredMessage="Password can't be empty"/>
                            <p:message id="passwordMsg" for="pass" styleClass="longMsg" />
                            
                            <h:outputLabel for="pwd2" value="Confirm Password"/>
                            <p:password id="pwd2" label="Confirm Password" required="true" requiredMessage="Confirm Password can't be empty"/>
                            <p:message id="passwordConfirmMsg" for="pwd2" styleClass="longMsg"/>
                            
                            <p:outputLabel value=" "/>
                            <f:facet name="footer">
                            <p:commandButton styleClass="onRightBtn" action="#{guestHome.submitRegistration}" value="Signup" ajax="true" update="@all" />
                            </f:facet>
                        </p:panelGrid>
                       
                        
                        <p:fieldset>

                            <p:link  outcome="/index" value="Login" styleClass="login-auxiliary-text"/>
                        
                        </p:fieldset>
                        
                    </h:form>

            </ui:define>

        </ui:composition>

    </body>
</html>
